package main

import (
	"os"
	"os/signal"
	"pd/conf"
	"pd/protocol"
	"syscall"
)

func main() {
	confFile := "etc/config.toml"
	if err := conf.Start(confFile); err != nil {
		panic(err)
	}
	p := protocol.NewHttpService()
	ch := make(chan os.Signal, 1)
	signal.Notify(ch, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP, syscall.SIGINT)
	// 后台监测来自外部的命令，优雅关闭
	go p.WaitStop(ch)

	if err := p.Start(); err != nil {
		panic(err)
	}
}
